{% extends "jbbase.html" %}
{% block title %}OVIM - Job Monitor{% endblock %}

{% block head %}
<script type="text/javascript">var DHTML_SUITE_THEME = 'zune';</script>
<script type="text/javascript" src="/ovim/media/js/ajax.js"></script>
<script type="text/javascript" src="/ovim/media/js/dhtml-suite-for-applications.js"></script>
{% endblock %}

{% block navbar %}
<a class="navbar" href="/ovim/monitjb/"> >> Job Monitor</a>
{% endblock %}

{% block action %}
<div class="action">
	<h3>ACTIONS</h3>
	<div id="actionmenu">
		<ul>
			<li>
				<a href="#" title="Cancel all running jobs">
					<img src="/ovim/media/img/process-stop.png"/>
					Cancel All!
				</a>
			</li>	
		</ul>
	</div>
</div>
{% endblock %}

{% block content %}
{% if jbs %}
<div class="ovim_content">
	<script type="text/javascript">
	tooltipObj = new DHTMLSuite.dynamicTooltip();
	</script>
	<h3>Jobs</h3>
	<div class="ovim_content_box_table">
		<div>
		<table id="jbTable">
			<thead>
				<tr>
					<td></td>
					<td>Submit On</td>
					<td>Type</td>
					<td>VM Name</td>
					<td>Start</td>
					<td>End</td>
				</tr>
			</thead>
			<tbody>
			{% for jb in jbs %}
				<tr>
					<td>
					<a href="#" onmouseover="tooltipObj.displayTooltip('/ovim/logview/jobid={{ jb.id }}/',this);return false">
					<img src=
					{% ifequal jb.state 'READY' %}
						"/ovim/media/img/icon_clock.gif"
					{% endifequal %}
					{% ifequal jb.state 'PERFORMING' %}
						"/ovim/media/img/selector-addall.gif"
					{% endifequal %}
					{% ifequal jb.state 'SUCCESS' %}
						"/ovim/media/img/icon_success.gif"
					{% endifequal %}
					{% ifequal jb.state 'ERROR' %}
						"/ovim/media/img/icon_error.gif"
					{% endifequal %}
					/></a>
					</td>
					<td><span style="display:none">{{ jb.subdate|date:"Y/m/d-Hi" }}</span>{{ jb.subdate|date:"j/m/y H:i" }}</td>
					<td>{{ jb.get_type_display }}</td>
					<td>{{ jb.vm.name }}</td>
					<td>{{ jb.startdate|date:"j/m/y H:i" }}</td>
					<td>{{ jb.enddate|date:"j/m/y H:i" }}</td>
				</tr>
			{% endfor %}
			</tbody>
		</table>
		</div>
	</div>
</div>
<script type="text/javascript">

var tableWidgetObj = new DHTMLSuite.tableWidget();
tableWidgetObj.setTableId('jbTable');
tableWidgetObj.setTableWidth('95%');
tableWidgetObj.setTableHeight(200);
tableWidgetObj.setColumnSort(Array(false, 'S', 'S', 'S', 'S', 'S'));
tableWidgetObj.init();
tableWidgetObj.sortTableByColumn(1, 'descending');
</script>
{% else %}
	<div class="ovim_content">
		<h3>No job found.</h3>
	</div>
{% endif %}
{% endblock %}

